﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace LPV_POS.mh_pos.mh_cauhinh
{
    public partial class mh_cauhinh_menuchucnang : DevExpress.XtraEditors.XtraForm
    {
        public mh_cauhinh_menuchucnang()
        {
            InitializeComponent();
        }

        #region "   Ban Hang"
        private void btnForeColor_BanHang_Click(object sender, EventArgs e)
        {
            mh_color omh_color = new mh_color();
            Color _cMauChu = omh_color.ShowForm();
            if (omh_color.DialogResult == DialogResult.OK)
            {
                lblBanHang.ForeColor = _cMauChu;
                foreach (System.Windows.Forms.Control ctr in panel_BanHang.Controls)
                    if (ctr.Name == lblBanHang.Tag + "")
                    {
                        ctr.ForeColor = _cMauChu;
                        break;
                    }
            }
        }

        private void btnFont_banHang_Click(object sender, EventArgs e)
        {
            mh_phongchu omh_phongchu = new mh_phongchu(lblBanHang.Font.FontFamily.Name, lblBanHang.Font.Size+"", Color.Black);
            Font _fFontChu = omh_phongchu.ShowForm_Font();
            if (omh_phongchu.DialogResult == DialogResult.OK)
            {
                lblBanHang.Font = _fFontChu;
                foreach (System.Windows.Forms.Control ctr in panel_BanHang.Controls)
                    if (ctr.Name == lblBanHang.Tag + "")
                    {
                        ctr.Font = _fFontChu;
                        break;
                    }
            }
        }

        private void lblBackColor_BanHang_Click(object sender, EventArgs e)
        {
            mh_color omh_color = new mh_color();
            Color _cMaunen = omh_color.ShowForm();
            if (omh_color.DialogResult == DialogResult.OK)
            {
                lblBanHang.BackColor = _cMaunen;
                foreach (System.Windows.Forms.Control ctr in panel_BanHang.Controls)
                    if (ctr.Name == lblBanHang.Tag + "")
                    {
                        ctr.BackColor = _cMaunen;
                        break;
                    }
            }
        }

        private void btnLuu_BanHang_Click(object sender, EventArgs e)
        {
            cpublic ocpublic = new cpublic();
            foreach (System.Windows.Forms.Control ctrl in panel_BanHang.Controls)
                ocpublic.luuControl_FontColor("menufunction"+ctrl.Name, ctrl);
            new mh_thongbao("Lưu thành công", 2).ShowDialog();
        }
        #endregion

        #region "   So Do Ban"
        private void btnForeColor_SoDoBan_Click(object sender, EventArgs e)
        {
            mh_color omh_color = new mh_color();
            Color _cMauChu = omh_color.ShowForm();
            if (omh_color.DialogResult == DialogResult.OK)
            {
                lblSoDoBan.ForeColor = _cMauChu;
                foreach (System.Windows.Forms.Control ctr in panel_SoDoBan.Controls)
                    if (ctr.Name == lblSoDoBan.Tag + "")
                    {
                        ctr.ForeColor = _cMauChu;
                        break;
                    }
            }
        }

        private void lblBackColor_SoDoBan_Click(object sender, EventArgs e)
        {
            mh_color omh_color = new mh_color();
            Color _cMaunen = omh_color.ShowForm();
            if (omh_color.DialogResult == DialogResult.OK)
            {
                lblSoDoBan.BackColor = _cMaunen;
                foreach (System.Windows.Forms.Control ctr in panel_SoDoBan.Controls)
                    if (ctr.Name == lblSoDoBan.Tag + "")
                    {
                        ctr.BackColor = _cMaunen;
                        break;
                    }
            }
        }

        private void btnFont_SoDoBan_Click(object sender, EventArgs e)
        {
            mh_phongchu omh_phongchu = new mh_phongchu(lblBanHang.Font.FontFamily.Name, lblBanHang.Font.Size+"", Color.Black);
            Font _fFontChu = omh_phongchu.ShowForm_Font();
            if (omh_phongchu.DialogResult == DialogResult.OK)
            {
                lblSoDoBan.Font = _fFontChu;
                foreach (System.Windows.Forms.Control ctr in panel_SoDoBan.Controls)
                    if (ctr.Name == lblSoDoBan.Tag + "")
                    {
                        ctr.Font = _fFontChu;
                        break;
                    }
            }
        }

        private void btnLuu_SoDoban_Click(object sender, EventArgs e)
        {
            cpublic ocpublic = new cpublic();
            foreach (System.Windows.Forms.Control ctrl in panel_SoDoBan.Controls)
                ocpublic.luuControl_FontColor("menufunction" + ctrl.Name, ctrl);
            new mh_thongbao("Lưu thành công", 2).ShowDialog();
        }
        #endregion

        #region "   Load Format"
        #region "   Load_So Do ban"
        void Load_So_Do_ban()
        {
            cpublic ocpublic = new cpublic();
            foreach (System.Windows.Forms.Control ctrl in panel_SoDoBan.Controls)
                ocpublic.loadControl_FontColor("menufunction" + ctrl.Name, ctrl);
        }
        #endregion

        #region "   Load_BanHang"
        void Load_BanHang()
        {
            cpublic ocpublic = new cpublic();
            foreach (System.Windows.Forms.Control ctrl in panel_BanHang.Controls)
                ocpublic.loadControl_FontColor("menufunction" + ctrl.Name, ctrl);
        }
        #endregion
        #endregion

        #region "   mh_cauhinh_menuchucnang_Load"
        private void mh_cauhinh_menuchucnang_Load(object sender, EventArgs e)
        {
            this.Load_BanHang();
            this.Load_So_Do_ban();
        }
        #region "   btnThoat_Click"
        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
        #endregion
        #endregion

        #region "   _Click"
        #region "   lblTrangChu_Click"
        private void lblTrangChu_Click(object sender, EventArgs e)
        {

            try
            {
                Label lbl = (Label)sender;
                lblBanHang.Text = lbl.Text;
                lblBanHang.Font = lbl.Font;
                lblBanHang.ForeColor = lbl.ForeColor;
                lblBanHang.BackColor = lbl.BackColor;
                lblBanHang.Tag = lbl.Name;
                //this.Refresh();
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
        }
        #endregion

        #region "   lblTrangChu_sodoban_Click"
        private void lblTrangChu_sodoban_Click(object sender, EventArgs e)
        {
            try
            {
                Label lbl = (Label)sender;
                lblSoDoBan.Text = lbl.Text;
                lblSoDoBan.Font = lbl.Font;
                lblSoDoBan.ForeColor = lbl.ForeColor;
                lblSoDoBan.BackColor = lbl.BackColor;
                lblSoDoBan.Tag = lbl.Name;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
        }
        #endregion
        #endregion
    }
}